import axios from 'axios';

import {
  WmsLayerRecord,
  WmsLayerParams,
  WmsLayerPageResponse,
  WmsLayerListParams,
  WmsLayerListResponse,
} from './types';

// 分页查询
export function queryWmsLayerPage(data: WmsLayerListParams) {
  return axios.post<WmsLayerPageResponse>(
    `/api/wmsLayer/page/${data.current}/${data.pageSize}`,
    data
  );
}

// 模糊查询
export function queryWmsLayer(data?: WmsLayerListParams) {
  return axios.post<WmsLayerListResponse>(`/api/wmsLayer/query`, data);
}

// 添加
export function addWmsLayer(data: WmsLayerParams) {
  return axios.post<WmsLayerRecord>(`/api/wmsLayer`, data);
}

// 删除
export function delWmsLayer(id: number) {
  return axios.delete<WmsLayerRecord>(`/api/wmsLayer/${id}`);
}

// 修改
export function editWmsLayer(data: WmsLayerParams) {
  return axios.put<WmsLayerRecord>(`/api/wmsLayer`, data);
}
